game.Camera = function () {
    var winSize = cc.winSize;
    var centerPos = cc.p(0, 0);
    //var destPos = null;
    var listeners = [];
    var dirty = false;
    return {
        addListener: function (listener) {
            listeners.push(listener);
        },
        set x(x) {
            centerPos.x = x;
            dirty = true;
        },
        get x() {
            return centerPos.x;
        },
        set y(y) {
            centerPos.y = y;
            dirty = true;
        },
        get y() {
            return centerPos.y;
        },
        set pos(pos) {
            centerPos.x = pos.x;
            centerPos.y = pos.y;
            dirty = true;
        },
        get pos(){
            return centerPos;
        },
        update: function (dt) {
            if (dirty) {
                listeners.forEach(function (listener) {
                    listener(centerPos);
                });
                dirty = false;
            }
        }
    };
};